package com.gking.centerSystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gking.centerSystem.entity.Sort;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface SortMapper extends BaseMapper<Sort> {


    /**
     * 获取所有分类信息
     *
     * @return
     */
    @Select("<script>" +
            "SELECT DISTINCT sort.* , rootSystem.createTime " +
            "FROM sy_sort sort " +
            "JOIN sy_root_system rootSystem ON rootSystem.systemCode = sort.systemCode " +
            "WHERE rootSystem.enable = 0 AND rootSystem.isDelete = 0 " +
            "AND sort.isDelete = 0 " +
            "ORDER BY rootSystem.createTime DESC, sort.systemCode ASC, sort.weight ASC, sort.createTime DESC " +
            "</script>")
    List<Sort> getAllSortList();

}
